package com.cqjtu.eecs.controller;


import com.cqjtu.eecs.entity.vo.TrainingProjectCourseVO;
import com.cqjtu.eecs.exception.ParamsErrorException;
import com.cqjtu.eecs.service.ITrainingProjectCourseService;
import com.cqjtu.eecs.utils.Assert;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2022-02-28
 */
@RestController
@RequestMapping("/training-project-course")
@Api(tags = "培养方案-课程接口")
public class TrainingProjectCourseController {
    private final ITrainingProjectCourseService trainingProjectCourseService;

    public TrainingProjectCourseController(ITrainingProjectCourseService trainingProjectCourseService) {
        this.trainingProjectCourseService = trainingProjectCourseService;
    }

    @ApiOperation("通过专业代码获取模板中的理论课程")
    @GetMapping("/theory-course-list/{id}")
    public TrainingProjectCourseVO getTrainingProjectCourseVOById(@PathVariable("id") String id){
        Assert.notNull(id, new ParamsErrorException("专业代码不能为空"));
        return trainingProjectCourseService.getTrainingProjectCourseVOById(id);
    }

    @ApiOperation("通过专业代码获取模板中的实践课程")
    @GetMapping("/practical-course-list/{majorCode}")
    public TrainingProjectCourseVO getPracticalCourseListByMajorCode(@PathVariable String majorCode) {
        Assert.notNull(majorCode, new ParamsErrorException("专业代码不能为空"));
        return trainingProjectCourseService.getPracticalCourseListByMajorCode(majorCode);
    }
}
